//数据字典工具
import pinia from "@store/pinia";

import useDictStore from "@store/modules/dict";
const dictStore = useDictStore(pinia);

//通过字典类型key获取字典数据列表
export function getDictDataList(key:string){
    return dictStore.dictDatas[key]? dictStore.dictDatas[key] : []
}

//通过字典类型key和字典值获取label
export function getDictLabel(key:string,value:string){    
    let label = undefined
    const dictDataList = dictStore.dictDatas[key]
    if(dictDataList){
        dictDataList.forEach(element => {
            if(element.value === value){
                label = element.label
            }
        });
    }
    return label
}

export enum DictTypeEnum {
    '性别' = 'XING_BIE',
}